import 'package:flutter/material.dart';

class User with ChangeNotifier {
  String userId;
  String userName;
  String phone;
  String sex;
  String birth;
  String email;
  String imgUrl;
  String headBg;
  String introduce;
  String local;
  String qqId;
  String wxId;
  String wbId;
  int vip;
  String vipTerm;
  int rate;
  int status;
  int role;
  String createAt;
  String updateAt;

  update(User user) {
    this.userId = user.userId;
    this.userName = user.userName;
    this.phone = user.phone;
    this.sex = user.sex;
    this.birth = user.birth;
    this.email = user.email;
    this.imgUrl = user.imgUrl;
    this.headBg = user.headBg;
    this.introduce = user.introduce;
    this.local = user.local;
    this.qqId = user.qqId;
    this.wxId = user.wxId;
    this.wbId = user.wbId;
    this.createAt = user.createAt;
    this.updateAt = user.updateAt;
    this.vip = user.vip;
    this.vipTerm = user.vipTerm;
    notifyListeners();
  }

  User({
    this.userId,
    this.userName,
    this.phone,
    this.sex,
    this.birth,
    this.email,
    this.imgUrl,
    this.headBg,
    this.introduce,
    this.local,
    this.qqId,
    this.wxId,
    this.wbId,
    this.vip,
    this.vipTerm,
    this.rate,
    this.status,
    this.role,
    this.createAt,
    this.updateAt,
  });

  User.fromJson(Map<String, dynamic> json) {
    userId = json['userId'];
    userName = json['userName'];
    phone = json['phone'];
    sex = json['sex'];
    birth = json['birth'];
    email = json['email'];
    imgUrl = json['imgUrl'];
    headBg = json['headBg'];
    introduce = json['introduce'];
    local = json['local'];
    qqId = json['qqId'];
    wxId = json['wxId'];
    wbId = json['wbId'];
    vip = json['vip'];
    vipTerm = json['vipTerm'];
    rate = json['rate'];
    status = json['status'];
    role = json['role'];
    createAt = json['createAt'];
    updateAt = json['updateAt'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['userId'] = this.userId;
    data['userName'] = this.userName;
    data['phone'] = this.phone;
    data['sex'] = this.sex;
    data['birth'] = this.birth;
    data['email'] = this.email;
    data['imgUrl'] = this.imgUrl;
    data['headBg'] = this.headBg;
    data['introduce'] = this.introduce;
    data['local'] = this.local;
    data['vip'] = this.vip;
    data['vipTerm'] = this.vipTerm;
    data['rate'] = this.rate;
    data['status'] = this.status;
    data['role'] = this.role;
    data['createAt'] = this.createAt;
    data['updateAt'] = this.updateAt;
    return data;
  }
}
